<?php
@session_start();
include_once 'transport.php';
?>
<!DOCTYPE html>
<html>
    <head>
        <title>Gráfico</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="stylesheet" type="text/css" href="../style/css/demo_table.css"/>
    <link rel="stylesheet" type="text/css" href="../style/css/demo_page.css"/>
    <link rel="stylesheet" type="text/css" href="../style/css/jquery.dataTables_themeroller.css"/>
    <link type="text/css" href="../style/css/start/jquery-ui-1.8.23.custom.css" rel="stylesheet" />	
    <script type="text/javascript" src="../js/jquery.min.js"></script> 
    <script type="text/javascript" src="../js/jquery-1.6.2.min.js"></script> 
    <script type="text/javascript" src="../js/jquery-ui-1.8.16.custom.min.js"></script> 
    <script type="text/javascript" src="../js/jquery.metadata.js"></script> 
    <script type="text/javascript" src="../js/jquery.hoverIntent.js"></script> 
    <script type="text/javascript" src="../js/jquery.dataTables.js"></script>
    <script type="text/javascript" src="../js/BSWS_jquery.dataTables.columnFilter.js"></script>
    <script type="text/javascript" src="../js/mbMenu.js"></script>
    <link rel="stylesheet" type="text/css" href="../style/css/style.css" media="screen" />
    <link rel="stylesheet" type="text/css" href="../style/css/menu_black.css" media="screen" />
    <script src='../js/jquery.maskedinput-1.3.min.js'  type='text/javascript'></script>
    <script src='../js/jquery.maskMoney.js'type='text/javascript'></script>
</head>
    <body style="font-size: small">
        <script type="text/javascript">
	jQuery(function() {
                
                jQuery( '#slider' ).bind( 'slidechange', null, function(){
                    jQuery( '#grafico' ).submit();
                });

                
                jQuery( '#tipo' ).buttonset();
               
                
                var dados = {
                    tipo: '<?php if(!isset($_REQUEST[tipo])){ echo 'mensal'; }else{ echo $_REQUEST[tipo]; }?>'
                }
                // Assign handlers immediately after making the request,
                // and remember the jqxhr object for this request
                    jQuery.ajax({
                        url: 'grafico_linhas.php',
                        data: dados
                    })
                    .done(function(data) { 
                        jQuery('#content').html('<img src="'+this.url+'">');
                    })
                    .fail(function(data) { alert('fail'); });
	});
	</script>
        <form id="grafico" method="post">
        <div style=" width: 60%;">
            <div id="slider"></div>
        </div>
            <input type="hidden" name="modo" value="<?php echo $_REQUEST[modo];?>"/>
            <div id="tipo">
                <input type="radio" id="tipoMensal" name="tipo" <?php if( !isset($_REQUEST[tipo] ) || $_REQUEST[tipo] == "mensal" ){echo "checked";} ?> value="mensal" onclick="javascript: jQuery( '#grafico' ).submit(); "><label for="tipoMensal">Período Mensal</label>
                <input type="radio" id="tipoDiario" name="tipo" <?php if( $_REQUEST[tipo] == "diario" ){echo "checked";} ?> value="diario" onclick="javascript: jQuery( '#grafico' ).submit(); "><label for="tipoDiario">Período Diário</label>
                <input type="radio" id="tipoHorario" name="tipo" <?php if( $_REQUEST[tipo] == "horario" ){echo "checked";} ?> value="horario" onclick="javascript: jQuery( '#grafico' ).submit(); "><label for="tipoHorario">Período Horário</label>
            </div>
        </form>
        <div id="content"></div>
    </body>
</html>